Replace unsafe raw pointers to the node tree#151
Replace unsafe raw pointers to the node tree#151matthunz wants to merge 8 commits intoDioxusLabs:mainfrom
Conversation
|
@matthunz This mostly all looks pretty good, but:
You might also want to consider making the type: struct NodeHandle<'a> {
doc: &'a Document,
node: &'a Node,
}Which would allow the type to implement more things. I think we should also look at adding a struct NodeHandleMut<'a> {
doc: &mut 'a Document,
node_id: NodeId,
}which would allow a lot of the methods from |
|
Thanks for the review!
Definitely! I think I got sucked into a bit of a rabbit hole here... I'll try to factor out the less controversial stuff
Ooo yeah I actually like that a lot better
That sounds interesting too, it does sound like we'd have more flexibility to add things. I also really like the mutable handle for the same reasons. Just to clarify on that todo task though unfortunately it looks like |
The methods for
Nodecurrently seem unsafe, as aNodecan outlive its tree field of*mut Slab<Node>. It is also possible to obtain mutable references to the same node.Nodefields and methods